<!--现场鉴定排期-->
<template>
    <el-main>
    <el-main class="ep-body">
        <epl-top-bar :datas="{formData:form,panel:panel}" showPerson personType="PERSON_ALL_EXACT" psTagType="PERSON_INJURY_QUERY">
            <ep-button size="small" name="刷新"></ep-button>
        </epl-top-bar>
        <epl-userMessage dataType="person" idCount="4" >
        </epl-userMessage>


            <el-card class="ep-card">
                <el-form :model="form" :rules="rules" >
                    <el-row :gutter="10">
                        <ep-date  colspan="8" label="鉴定日期" name="bae561" :property="form.bae561"
                                  p="E"   :datas="{formData :form}" ></ep-date>
                        <ep-input  label="统筹区" name="aaa027" :property="form.aaa027"
                                   colspan="8"     p="E"   :datas="{formData :form}" ></ep-input>
                    </el-row>
                </el-form>
            </el-card>

            <el-card class="ep-card">
                <el-row>
                    <ep-table :data="tableData" border style="width: 100%;" >
                        <el-table-column type="selection" width="55"></el-table-column>
                        <el-table-column sortable prop="no" label="序号"></el-table-column>
                        <el-table-column sortable prop="baz501" label="鉴定场次"></el-table-column>
                        <el-table-column sortable prop="bac511" label="鉴定场次名称"></el-table-column>
                        <el-table-column sortable prop="bae561" label="鉴定时间"></el-table-column>
                        <el-table-column sortable prop="bae510" label="鉴定地点"></el-table-column>
                        <el-table-column sortable prop="blc562" label="鉴定科别"></el-table-column>
                        <el-table-column sortable prop="bae522" label="额定人数"></el-table-column>
                        <el-table-column sortable prop="bae522s" label="已申请人数"></el-table-column>
                    </ep-table>
                </el-row>
            </el-card>
            <!--新增修改页面-->

            <el-card class="ep-card">
                <el-form :model="form" :rules="rules" >
                    <el-row :gutter="10">
                        <ep-input  label="鉴定场次" name="baz501" :property="form.baz501"
                                   p="H"   :datas="{formData :form}" ></ep-input>
                        <ep-input  label="鉴定场次名称" name="bac511" :property="form.bac511"
                                   colspan="8"     p="R"   :datas="{formData :form}" ></ep-input>
                        <ep-date  label="鉴定日期" name="bae561" :property="form.bae561" isChange
                                  colspan="8"   p="R"   :datas="{formData :form}" ></ep-date>
                        <ep-input  label="额定人数" name="bae522" :property="form.bae522"
                                   colspan="8"   p="R"   :datas="{formData :form}" ></ep-input>
                    </el-row>
                    <el-row :gutter="10">
                        <ep-input  label="鉴定地点ID" name="baz502" :property="form.baz502"
                                   p="H"   :datas="{formData :form}" ></ep-input>
                        <ep-input  label="鉴定地点名称" name="baz502name" :property="form.baz502name"
                                   colspan="8"   p="R"   :datas="{formData :form}" ></ep-input>
                        <ep-select  label="鉴定科别" name="blc504" :property="form.blc504" isChange
                                    colspan="8"   codetype="BLC504"   p="R"   :datas="{formData :form}" ></ep-select>
                    </el-row>

                </el-form>
            </el-card>
                <el-card class="ep-card">
                    <el-row type="flex" justify="center">
                        <ep-saveButton id="doSave" top="20" type="primary" bottom="20"
                                       :datas="{formData: form,panel:panel}" name="保存"></ep-saveButton>
                    </el-row></el-card>

    </el-main>
    </el-main>
</template>
<script type="es6">
    export default {
        data() {
            return {
                form:{
                    bae561: {
                        value: '',
                        p: 'E'
                    },
                    aaa027: {
                        value: '',
                        p: 'E'
                    },
                    baz501: {
                        value: '',
                        p: 'H'
                    },
                    bac511: {
                        value: '',
                        p: 'R'
                    },
                    bae561: {
                        value: '',
                        p: 'R'
                    },
                    bae522: {
                        value: '',
                        p: 'R'
                    },
                    baz502: {
                        value: '',
                        p: 'H'
                    },
                    baz502name: {
                        value: '',
                        p: 'R'
                    },
                    blc504: {
                        key: '',
                        value: '',
                        p: 'R'
                    },

                },
                tableData: [],
                panel: {},

                rules:{
                    bac511: [
                        {required: true, message: '必填项，不能为空'}
                    ],
                    bae561: [
                        {required: true, message: '必填项，不能为空'}
                    ],
                    bae522: [
                        {required: true, message: '必填项，不能为空'}
                    ],
                    baz502name: [
                        {required: true, message: '必填项，不能为空'}
                    ],
                    blc504: [
                        {required: true, message: '必填项，不能为空'}
                    ],

                },
                codeTypes:{
                    BLC504:[],

                },
                pager: {
                    page: 1,
                    size: 10
                },
                total: 0,
            }
        },
        computed: {
            backFun() {
                return this.$store.getters.backFun;
            },
            init_formData() {
                if (this.$store.getters.init.path !== this.$route.path)  return;
                return this.$store.getters.init.form;
            },
            doInitformData: {
                get: function () {
                    if (this.$store.getters.common === null) return [];
                    if (this.$store.getters.common.path !== this.$route.path) return;
                    return this.$store.getters.common.formData;
                },
                set: function (newValue) {
                    if (newValue.path !== this.$route.path) return;
                    return newValue;
                }
            },
            init_panel() {
                if (this.$store.getters.init.path !== this.$route.path)  return;
                return this.$store.getters.init.panel;
            },
            doInitpanel: {
                get: function () {
                    if (this.$store.getters.common === null) return [];
                    if (this.$store.getters.common.path !== this.$route.path) return;
                    return this.$store.getters.common.panel;
                },
                set: function (newValue) {
                    if (newValue.path !== this.$route.path) return;
                    return newValue;
                }
            },

        },
        created() {
            let param = {
                path: this.$route.path,
                codeTypes:this.codeTypes,
                form:this.form,
                tableData:this.tableData,
                panel:this.panel

            };
            this.$store.dispatch('SET_INIT', param);
        },
        watch: {
            init_formData: {
                handler(value) {
                    if (value == undefined) return;
                    this.getformData(value);
                },
                deep: true
            },
            doInitformData: {
                handler(value) {
                    if (value == undefined) return;
                    this.getformData(value);
                },
                deep: true
            },
            init_panel: {
                handler(value) {
                    if (value == undefined) return;
                    this.getpanel(value);
                },
                deep: true
            },
            doInitpanel: {
                handler(value) {
                    if (value == undefined) return;
                    this.getpanel(value);
                },
                deep: true
            },

            backFun: {
                handler(value) {
                    if (value === null) return;
                    this.customBackFun();
                    let backFun = [];
                    backFun = value.split(',');
                    if (backFun.indexOf('rDoInit') >= 0) {
                        let codeTypes = {
                            BLC504:[],

                        };
                        let form = {
                            bae561: {
                                value: '',
                                p: 'E'
                            },
                            aaa027: {
                                value: '',
                                p: 'E'
                            },
                            baz501: {
                                value: '',
                                p: 'H'
                            },
                            bac511: {
                                value: '',
                                p: 'R'
                            },
                             bae522: {
                                value: '',
                                p: 'R'
                            },
                            baz502: {
                                value: '',
                                p: 'H'
                            },
                            baz502name: {
                                value: '',
                                p: 'R'
                            },
                            blc504: {
                                key: '',
                                value: '',
                                p: 'R'
                            },

                        };
                        let tableData= [];
                        let panel= {};

                        let param = {
                            path: this.$route.path,
                            codeTypes:codeTypes,
                            form:form,
                            tableData:tableData,
                            panel:panel

                        };
                        this.$store.dispatch('SET_INIT', param);
                    }
                }
            }
        },
        methods: {
            getformData(value) {
                this.form = value;
            },
            getpanel(value) {
                this.panel = value;
            },

            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
            },
            handleEdit(id) {
                this.dialogFormVisible = true;
            },
            customBackFun(){//自定义方法体
            },
        },
    }
</script>
